import { apiPrefix } from '@/consts/consts'

export default ({ $service:request }) => ({
  // 4.4.8、查看租户详情
  tenantDetail(params) {
    return request({
      url: `${apiPrefix}/api/v1/tenant/detail`,
      method: 'get',
      params
    })
  },

  // 5.2.6．用户名+密码登录
  login: ({ account, password }) => {
    return request({
      url: `${apiPrefix}/api/v1/user/login`,
      method: 'post',
      data: { account: account, password: window.btoa(password) }
    })
      .then(res => {
        return res
      })
  },
  // 5.2.7．用户退出   vuex setInfo中重置对应的值
  logout() {
    return request({
      url: `${apiPrefix}/api/v1/user/logout`,
      method: 'post'
    })
  },

  // 4.2.1、发送短信验证码
  smsVerifyCode(data) {
    return request({
      url: `${apiPrefix}/api/v1/sms_verify_code`,
      method: 'post',
      data
    })
  },
  
  // 4.2.2、短信验证码登录
  loginVerifyCode(data) {
    return request({
      url: `${apiPrefix}/api/v1/login_sms_verify_code`,
      method: 'post',
      data
    })
  },
  
  // 4.2.4、检查手机号是否存在
  phoneCheck(data) {
    return request({
      url: `${apiPrefix}/api/v1/phone/check`,
      method: 'post',
      data
    })
  },

  // 4.1.9、重置密码
  loginResetPassword(data){
    return request({
      url: `${apiPrefix}/api/v1/user/resetpassword`,
      method: 'post',
      data
    })

  },


   //4.2.3、绑定手机号√
  loginBindPhone(data){
    return request({
      url: `${apiPrefix}/api/v1/bind/phone`,
      method: 'post',
      data
    })
  },

   // 4.1.7、修改密码-√
  modifypassword(data,id){
    return request({
      url:`${apiPrefix}/api/v1/user/modifypassword/${id}`,
      method: 'post',
      data
    })
  }


})
